
#ifndef _TTG_DEVICES_ID_MANAGER_
#define _TTG_DEVICES_ID_MANAGER_
#include "Common/Definitions.h"

#include "Devices.h"

namespace ttg_internal
{
	namespace devices
	{
		//Static class, that generates ID for Devices and APIs.
		class IdManager
		{
			private:
				static IdManager *ref;
				static inline void safeInit()
				{
					if (ref == NULL)
						ref = new IdManager();
				}
			private:
				std::vector<ttg::devices::ApiID> cur_api_ids;
			public:
				//Creates new ID for device.
				ttg::devices::DeviceID generateDeviceID();
				//Returns count of registered devices.
				inline size_t getDeviceCount()
				{ return cur_api_ids.size(); }
				//Creates new ID for API for required Device.
				ttg::devices::ApiID generateApiID(ttg::devices::DeviceID device);
				//Returns count of registered API for required device.
				size_t getApiCount(ttg::devices::DeviceID device);
				//Returns reference to instance (that always exists).
				static inline IdManager *getRef()
				{ safeInit(); return ref; }
		};
	}
}

#endif
